<template>
    <tr>
        <td><input type="checkbox"></td>
        <td>
            <span class="state" v-show="work.state == 0">未审核</span>
            <span class="state" v-show="work.state == 1">已通过</span>
            <span class="state" v-show="work.state == 2">未通过</span>
        </td>
        <td>
            <span class="classify">{{work.classify}}</span>
        </td>
        <td>
            <span class="company">{{work.company}}</span>
        </td>
        <td>
            <span class="shop">{{work.address}}</span>
        </td>
        <td>
            <span class="name">{{work.name}}</span>
        </td>
        <td>
            <span class="salary">{{work.salary}}</span>
        </td>
        <td>
            <span :title="work.condition">{{work.condition}}</span>
        </td>
        <td>
            <span :title="work.discribe">{{work.description}}</span>
        </td>
        <td>
            <span class="number">{{work.recruits}}/{{work.totalNumber}}</span>
        </td>
        <td class="do">
          <button class="deleteUser">删除</button>
          <button class="audite" v-show="work.state == 0" @click="examine()">审核</button>
        </td>
    </tr>
</template>

<script>
export default {
    name: 'WorkadminItem',
    props:['work','searchWorks','checkThis'],
    methods:{
        examine(){
            this.$store.state.dialog = 3;
            this.$store.state.workAdmin = this.work
        },
        handleDelete(id){
          if(confirm('您确定要删除吗？')){
            // this.deleteTodo(id)
            this.$bus.$emit('deleteListData',{isFirst:false,isLoading:true,errMag:'',users:[]})
            axios.post(`http://123.57.251.41:8080/admin-job/delJob?id=${id}`,{headers:{'Authentication-Token': JSON.parse(sessionStorage.getItem("token"))}}).then(
                response =>{
                    console.log('删除成功了')
                    console.log(response.data.data.list)
                    this.searchWorks()
                },
                error =>{
                    console.log(id)
                    alert("删除失败了",console.log(error))
                }
            )
          }
        },
        checkthis(id){
            this.checkThis(id)
        }
    }
}
</script>

<style lang="less" scoped>
tr{
    background-color: #f9f9f9;
    a{
        color: #337ab7;
    }
}
.do{
    width: 110px;
}
.state{
    width: 62px;
}
.classify{
    width: 79px;
}
.company{
    width: 62px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space:nowrap;
}
td{
    padding:4px;
    font-size: 16px;
    vertical-align: middle;
    span{
        display: inline-block;
        width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space:nowrap;
    }
    input{
        text-overflow: ellipsis;
    }
    button{
        border: 1px solid;
        border-radius: 2px;
        margin-right: 5px;
        font-size: 12px;
        padding: 4px 10px;
        cursor: pointer;
    }
    .changeUser{
        color: #71e2a3;
        background-color: #e7faf0;
        border-color: #d0f5e0;
    }
    .deleteUser{
        color: #ff9292;
        background-color: #ffeded;
        border-color: #ffdbdb;
    }
    .audite{
        color: #ffba00;
        background: #fff8e6;
        border-color: #ffe399;
    }
}
.salary{
    max-width: 100px !important;
}
.number{
    max-width: 70px;
}
.name{
    max-width: 80px;
}
.shop{
    max-width: 100px;
}
</style>